require("../../@babel/runtime/helpers/Arrayincludes"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "components/user-task/index" ], {
    "0686": function(t, e, n) {
        (function(t) {
            var a = n("4ea4").default;
            Object.defineProperty(e, "__esModule", {
                value: !0
            }), e.default = void 0;
            var s = a(n("a34a")), i = a(n("c973")), r = a(n("ded3")), o = n("26cb"), u = n("6c67"), c = a(n("2de2")), l = n("48b8"), d = n("3be3"), f = a(n("0613")), g = {
                components: {},
                props: {
                    isFromHome: {
                        type: Boolean,
                        default: !1
                    },
                    orderInfo: {
                        default: function() {
                            return {};
                        }
                    },
                    vehicleAttr: {
                        type: Number,
                        default: -1
                    },
                    otherSa: {
                        default: function() {
                            return {};
                        }
                    },
                    taskStyle: {
                        type: String,
                        default: ""
                    },
                    taskLabel: {
                        type: String,
                        default: ""
                    }
                },
                data: function() {
                    return {
                        lastRight: 0,
                        dynamicRight: "",
                        userTaskDetail: {},
                        stageInfoList: [],
                        countDownTimer: null,
                        countDownData: "",
                        needExpo: !1,
                        needDelayExpo: !1
                    };
                },
                computed: (0, r.default)((0, r.default)({}, (0, o.mapGetters)([ "startAddress", "isLogined" ])), {}, {
                    getStageInfoList: function() {
                        var t = (0, l.cloneDeep)(this.originPacketList);
                        if (t.length > 0 && !this.isLastSeq) {
                            var e = {
                                type: "car",
                                stage_status: "car"
                            }, n = this.getUserCurSeq;
                            if (0 === n) t.unshift(e); else {
                                var a = t.findIndex(function(t) {
                                    return t.seq === n;
                                });
                                t.splice(a + 1, 0, e);
                            }
                        }
                        return t;
                    },
                    getTaskStageClassName: function() {
                        return function(t) {
                            return {
                                "-1": "close",
                                0: "unclaimed",
                                1: "complete",
                                2: "expire",
                                3: "credited",
                                car: "car"
                            }[t];
                        };
                    },
                    getUserCurSeq: function() {
                        var t, e, n;
                        return "TO_START" === this.getTaskStatus ? 0 : null !== (t = null === (e = this.userTaskDetail) || void 0 === e || null === (n = e.progress_info) || void 0 === n ? void 0 : n.cur_seq) && void 0 !== t ? t : 0;
                    },
                    isLastSeq: function() {
                        var t;
                        return this.getUserCurSeq === (null !== (t = this.originPacketList.length) && void 0 !== t ? t : -1);
                    },
                    getTaskStatusText: function() {
                        return function(t) {
                            var e = t.stage_status, n = t.value;
                            return {
                                "-1": "".concat(n, "单"),
                                0: "待领取",
                                1: "已到账",
                                2: "已过期",
                                3: "已到账"
                            }[e];
                        };
                    },
                    getPointText: function() {
                        var t = this;
                        return function(e) {
                            var n = e.award_info, a = n.award_count, s = n.title;
                            return t.getUserCurSeq === e.seq - 1 ? "".concat(a > 1 ? s + "*" + a : s) : "";
                        };
                    },
                    getTaskStatus: function() {
                        var t, e;
                        return null !== (t = null === (e = this.userTaskDetail) || void 0 === e ? void 0 : e.task_status) && void 0 !== t ? t : "";
                    },
                    taskNotTake: function() {
                        return "TO_TAKE" === this.getTaskStatus;
                    },
                    isShow: function() {
                        var t, e;
                        if (!this.isLogined) return !1;
                        var n = null !== (t = null === (e = this.userTaskDetail) || void 0 === e ? void 0 : e.task_status) && void 0 !== t ? t : "";
                        return n && ![ "OUT_DATED", "AWARDED" ].includes(n);
                    },
                    getTaskDetailText: function() {
                        return this.originPacketList.find(function(t) {
                            return "0" === t.stage_status;
                        }) ? "去领奖" : "查看奖励";
                    },
                    isHideCountDownTimer: function() {
                        return [ "TO_TAKE", "NOT_STARTED" ].includes(this.getTaskStatus);
                    },
                    originPacketList: function() {
                        var t, e;
                        return null !== (t = null === (e = this.userTaskDetail) || void 0 === e ? void 0 : e.stage_info_list) && void 0 !== t ? t : [];
                    },
                    isOnlyOnePacket: function() {
                        return 1 === this.originPacketList.length;
                    },
                    getExpoStatus: function() {
                        return {
                            needDelayExpo: this.needDelayExpo,
                            needExpo: this.needExpo
                        };
                    }
                }),
                watch: {
                    getExpoStatus: {
                        handler: function() {
                            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = t.needDelayExpo, n = t.needExpo;
                            e && n && (this.taskSa(2), this.needExpo = !1, this.needDelayExpo = !1);
                        },
                        immediate: !0
                    }
                },
                methods: {
                    getDynamicRight: function() {
                        var e = this;
                        if (this.taskNotTake || !this.isShow) return !1;
                        this.isLastSeq ? this.dynamicRight = "right: 48rpx" : this.isOnlyOnePacket && 0 === this.getUserCurSeq ? this.dynamicRight = "right: 50%" : this.$nextTick(function() {
                            var n = t.createSelectorQuery().in(e), a = "";
                            n.select(".task-started").boundingClientRect(function(t) {
                                t && (a = t.width);
                            }).exec(), n.select(".car").boundingClientRect(function(t) {
                                t && (e.dynamicRight = "right: ".concat(Math.ceil(a - t.left), "px"));
                            }).exec();
                        });
                    },
                    getUserTask: function() {
                        var t = arguments, e = this;
                        return (0, i.default)(s.default.mark(function n() {
                            var a, i, r;
                            return s.default.wrap(function(n) {
                                for (;;) switch (n.prev = n.next) {
                                  case 0:
                                    if (i = t.length > 0 && void 0 !== t[0] ? t[0] : 0, e.isLogined) {
                                        n.next = 3;
                                        break;
                                    }
                                    return n.abrupt("return", !1);

                                  case 3:
                                    if (!e.getUserTaskLock) {
                                        n.next = 5;
                                        break;
                                    }
                                    return n.abrupt("return");

                                  case 5:
                                    return e.getUserTaskLock = !0, r = {
                                        city_id: null === (a = e.startAddress) || void 0 === a ? void 0 : a.city_id
                                    }, e.vehicleAttr >= 0 && (r.vehicle_attr = e.vehicleAttr), e.taskLabel && (r.taskLabel = e.taskLabel), 
                                    n.next = 11, (0, u.getUserTask)({
                                        args: JSON.stringify(r)
                                    }).then(function(t) {
                                        var n;
                                        e.getUserTaskLock = !1, 0 === t.ret ? (e.userTaskDetail = t.data || {}, e.getCountDown(), 
                                        e.$nextTick(function() {
                                            e.getDynamicRight();
                                        }), [ 1, 2 ].includes(i) && null !== (n = e.userTaskDetail) && void 0 !== n && n.user_task_id && (2 === i ? e.needDelayExpo = !0 : (e.needDelayExpo = !1, 
                                        e.taskSa(2)))) : (e.needDelayExpo = !1, e.userTaskDetail = {});
                                    }).catch(function() {
                                        e.getUserTaskLock = !1, e.needDelayExpo = !1, e.userTaskDetail = {};
                                    });

                                  case 11:
                                  case "end":
                                    return n.stop();
                                }
                            }, n);
                        }))();
                    },
                    takeUserTask: (0, l.throttle)(function() {
                        var t, e = this;
                        this.taskSa(1, "领任务"), (0, u.takeUserTask)({
                            args: JSON.stringify({
                                city_id: null === (t = this.startAddress) || void 0 === t ? void 0 : t.city_id,
                                task_id: this.userTaskDetail.task_id
                            })
                        }).then(function(t) {
                            0 === t.ret ? (e.userTaskDetail.user_task_id = t.data.user_task_id, e.getUserTask()) : e.$toast({
                                title: t.msg || "领取失败"
                            });
                        }).catch(function() {});
                    }),
                    goUserTaskDetail: function(e) {
                        var n = this;
                        return (0, i.default)(s.default.mark(function a() {
                            var i, r, o, u, l, f, g, h;
                            return s.default.wrap(function(a) {
                                for (;;) switch (a.prev = a.next) {
                                  case 0:
                                    return a.next = 2, (0, d.handleOneDaySubscribe)("user_task");

                                  case 2:
                                    "handle-reward" !== (u = null !== (i = null === (r = e.currentTarget.dataset) || void 0 === r ? void 0 : r.type) && void 0 !== i ? i : "card") && "card" !== u || n.taskSa(1, n.getTaskDetailText), 
                                    l = n.userTaskDetail, f = l.user_task_id, g = l.task_id, h = "".concat(c.default.uAppUrl, "/uapp/#/user-task-details?user_task_id=").concat(f, "&task_id=").concat(g, "&city_id=").concat(null === (o = n.startAddress) || void 0 === o ? void 0 : o.city_id, "&page_from=").concat(n.isFromHome ? 1 : 2), 
                                    t.navigateTo({
                                        url: "/pages/adWebview/index?targetUrl=".concat(encodeURIComponent(h))
                                    });

                                  case 7:
                                  case "end":
                                    return a.stop();
                                }
                            }, a);
                        }))();
                    },
                    getCountDown: function() {
                        var t, e, n = this, a = (null !== (t = null === (e = this.userTaskDetail) || void 0 === e ? void 0 : e.end_time) && void 0 !== t ? t : 0) - Date.now();
                        if (this.clearCountDown(), a <= 0) this.countDownData = ""; else {
                            var s = a / 1e3, i = Number.parseInt(s / 86400), r = Number.parseInt(s / 3600 % 24);
                            this.countDownTimer = setTimeout(function() {
                                n.getCountDown();
                            }, 1e3), this.countDownData = {
                                day: i,
                                hour: r > 1 ? r : 1
                            };
                        }
                    },
                    clearCountDown: function() {
                        this.countDownTimer && clearTimeout(this.countDownTimer);
                    },
                    getCurrentRoute: function() {
                        var t, e = getCurrentPages();
                        return null == e || null === (t = e[e.length - 1]) || void 0 === t ? void 0 : t.route;
                    },
                    taskSa: function() {
                        var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, e = arguments.length > 1 ? arguments[1] : void 0, n = this.userTaskDetail, a = n.user_task_id, s = n.task_id, i = n.stage_info_list, o = n.is_auto_start, u = n.is_auto_award, c = (0, 
                        r.default)((0, r.default)({}, this.otherSa), {}, {
                            task_status: "任务".concat(this.taskNotTake ? "未" : "已", "领取"),
                            reward_status: i[0].stage_status,
                            page_name: this.isFromHome ? "COLD" === this.taskLabel ? "冷运tab页" : "首页" : "订单详情",
                            user_task_id: a,
                            task_ids: s,
                            order_uuid: this.orderInfo.order_uuid,
                            order_status: this.orderInfo.order_status,
                            is_denoise: this.$store.getters.isDenoiseNewCache,
                            is_auto_get: o ? 1 : 0,
                            is_auto_reward: u ? 1 : 0,
                            task_type: 0 === i.length ? null : 1 === i.length ? "单阶梯任务" : "阶梯型任务"
                        });
                        1 === t && (c.module_name = e), this.isFromHome ? c.business_type = String(f.default.state.selectedService || 1) : c.business_type = "", 
                        this.$statistics(1 === t ? "task_system_click" : "task_system_expo", c);
                    },
                    setExpoStatus: function() {
                        this.needExpo = !0;
                    }
                }
            };
            e.default = g;
        }).call(this, n("543d").default);
    },
    "678b": function(t, e, n) {
        var a = n("ed62");
        n.n(a).a;
    },
    "92d4": function(t, e, n) {
        n.r(e);
        var a = n("b846"), s = n("e4dc");
        for (var i in s) [ "default" ].indexOf(i) < 0 && function(t) {
            n.d(e, t, function() {
                return s[t];
            });
        }(i);
        n("678b");
        var r = n("f0c5"), o = Object(r.a)(s.default, a.b, a.c, !1, null, "6fe457aa", null, !1, a.a, void 0);
        e.default = o.exports;
    },
    b846: function(t, e, n) {
        n.d(e, "b", function() {
            return a;
        }), n.d(e, "c", function() {
            return s;
        }), n.d(e, "a", function() {});
        var a = function() {
            var t = this, e = (t.$createElement, t._self._c, t.isShow && !t.taskNotTake ? t.__map(t.getStageInfoList, function(e, n) {
                var a = t.__get_orig(e), s = t.getTaskStageClassName(e.stage_status), i = t.getStageInfoList.length, r = "car" !== e.type ? t.getPointText(e) : null;
                return {
                    $orig: a,
                    m0: s,
                    g0: i,
                    m1: r,
                    m2: "car" !== e.type && r ? t.getPointText(e) : null,
                    m3: "car" !== e.type ? t.getTaskStatusText(e) : null
                };
            }) : null);
            t.$mp.data = Object.assign({}, {
                $root: {
                    l0: e
                }
            });
        }, s = [];
    },
    e4dc: function(t, e, n) {
        n.r(e);
        var a = n("0686"), s = n.n(a);
        for (var i in a) [ "default" ].indexOf(i) < 0 && function(t) {
            n.d(e, t, function() {
                return a[t];
            });
        }(i);
        e.default = s.a;
    },
    ed62: function(t, e, n) {}
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "components/user-task/index-create-component", {
    "components/user-task/index-create-component": function(t, e, n) {
        n("543d").createComponent(n("92d4"));
    }
}, [ [ "components/user-task/index-create-component" ] ] ]);